﻿using System;
using System.Runtime.Remoting;
using EasyHook;
using MassPokerTool.Core.Hooking;

namespace MassPokerTool
{
    class Program
    {
        static String _channelName = null;

        static void Main(string[] args)
        {
            log4net.Config.XmlConfigurator.Configure();
            try
            {
                try
                {
                    Config.Register(
                        "A MassPokerTool like demo application.",
                        "MassPokerTool.Inject.dll",
                        "MassPokerTool.Core.dll");
                }
                catch (ApplicationException)
                {
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                }
                RemoteHooking.IpcCreateServer<MassPokerInterface>(ref _channelName, WellKnownObjectMode.SingleCall);
                RemoteHooking.Inject(
                    2320,
                    "MassPokerTool.Inject.dll",
                    "MassPokerTool.Inject.dll",
                    _channelName);
                
                Console.ReadLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            Console.ReadLine();
        }
    }
}
